package com.yang.service;

import com.yang.dao.InfoDetailDao;
import com.yang.pojo.InfoDetail;

import java.sql.SQLException;
import java.util.ArrayList;

public class InfoDetailService {
    InfoDetailDao infoDetailDao = new InfoDetailDao();
    //根据类目id查询选项信息
    public ArrayList<InfoDetail> findInfoDetailByBasicId(int basicInfoId) throws SQLException {
        ArrayList<InfoDetail> infoDetails = infoDetailDao.selectInfoDetailByBasicInfoId(basicInfoId);
        return infoDetails;
    }

    //保存评估选项信息
    public boolean saveInfoDetail(String infoDetailName,String infoDetailDesc,int fkBasicInfoId) throws SQLException {
        int i = infoDetailDao.insertInfoDetail(infoDetailName,infoDetailDesc,fkBasicInfoId);
        return i>0;
    }
    //根据id查询评估选项信息
    public InfoDetail findInfoDetailById(int infoDetailId) throws SQLException {
        InfoDetail infoDetail = infoDetailDao.selectInfoDetailById(infoDetailId);
        return infoDetail;
    }

    //根据id修改评估选项信息
    public boolean updateInfoDetailById(String infoDetailName,String infoDetailDesc,int infoDetailId) throws SQLException {
        int i = infoDetailDao.updateInfoDetailById(infoDetailName, infoDetailDesc, infoDetailId);
        return i>0;
    }

    //根据id删除评估选项
    public boolean deleteInfoDetailById(int infoDetailId) throws SQLException {
        int i = infoDetailDao.deleteInfoDetailById(infoDetailId);
        return i>0;
    }
}
